/**
 * 格式化时间  去掉 最后 2位
 * @param value
 * @param row
 * @param index
 * @returns
 */
function timeFormatter_point(value, row, index){
	var str = value;
	if (str==null || str == ""){
		return;
	}
	if (str.substring(str.length+1, str.length-2) == (".0")) {
		return str.substring(0, str.length-2);
	} else if(str.indexOf("-") > 0 && str.indexOf(":") > 0){
		return str;
		//return timeFormatterAddTimezone(value, row, index, 8);
	} else {
		return unixFormatterYMDHMS(value, row, index);
	}
}
//首行序号
function indexFormatter(value, row, index) {  
	return index+1;  
}

/**
 * 格式化时间   秒 转  yyyy-mm-dd hh-MM-ss 格式
 * @param value
 * @param row
 * @param index
 * @returns
 */
function timeFormatter_sec(value, row,index){
   	var nS = value;	
   	if(nS!=null&&nS!=0){
 			 return new Date(parseInt(nS) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");      
   	}else{
   		return ;
   	}
}

/**
 * 格式化时间   毫秒 转  yyyy-mm-dd hh-MM-ss 格式
 * @param value
 * @param row
 * @param index
 * @returns
 */
function timeFormatter_Millisecond(value, row,index){
	var nS = value;	
	if(nS!=null&&nS!=0){
		return new Date(parseInt(nS)).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");      
	}else{
		return ;
	}
}

/**
 * 格式化时间
 * @param value
 * @param row
 * @param index
 * @returns {String}
 */
function unixFormatterYMDHMS(value, row, index) {
	if (value != null) {
		if(i == undefined || i == ""){
			i = 0;
		}
		var date = new Date(value);
	    var year = date.getFullYear().toString();
	    var month = (date.getMonth() + 1);
	    var day = date.getDate().toString();
	    var hour = date.getHours().toString();
	    var minutes = date.getMinutes().toString();
	    var seconds = date.getSeconds().toString();
	    if (month < 10) {
	        month = "0" + month;
	    }
	    if (day < 10) {
	        day = "0" + day;
	    }
	    
	    if (hour < 10) {
	        hour = "0" + hour;
	    }
	    if (minutes < 10) {
	        minutes = "0" + minutes;
	    }
	    if (seconds < 10) {
	        seconds = "0" + seconds;
	    }
	    return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
	}
}

/**
 * 格式化时间
 * @param value
 * @param row
 * @param index
 * @param i 时区
 * @returns {String}
 */
function timeFormatterAddTimezone(value, row, index, i) {
	if (value != null) {
		if(i == undefined || i == ""){
			i = 0;
		}
		i = i * 60 * 60 * 1000;
		var date = new Date(value);
		date = new Date(date.getTime() + i);
		var year = date.getFullYear().toString();
		var month = (date.getMonth() + 1);
		var day = date.getDate().toString();
		var hour = date.getHours().toString();
		var minutes = date.getMinutes().toString();
		var seconds = date.getSeconds().toString();
		if (month < 10) {
			month = "0" + month;
		}
		if (day < 10) {
			day = "0" + day;
		}
		
		if (hour < 10) {
			hour = "0" + hour;
		}
		if (minutes < 10) {
			minutes = "0" + minutes;
		}
		if (seconds < 10) {
			seconds = "0" + seconds;
		}
		return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
	}
}
/**
 * 根据json字典数据和该列的值获取字典名称
 * @param listJson
 * @param value
 * @returns
 */
function getTableColumnValueByDict(listJson,value){
	var listData = eval('(' + listJson + ')');
	for (var int = 0; int < listData.length; int++) {
		if (listData[int].value == value) {
			return listData[int].label;
		}
	}
}